import { ApiProperty } from '@nestjs/swagger'
import { Transform } from 'class-transformer'
import { IsEnum, IsNumber, IsOptional, IsString } from 'class-validator'
import { AsrTaskStatus, AsrTaskType } from '../interfaces/asr.interface'

export class AsrQueryDto {
  @ApiProperty({ description: '页码', required: false, default: 1 })
  @IsNumber()
  @IsOptional()
  @Transform(({ value }) => Number.parseInt(value, 10))
  page?: number = 1

  @ApiProperty({ description: '每页数量', required: false, default: 10 })
  @IsNumber()
  @IsOptional()
  @Transform(({ value }) => Number.parseInt(value, 10))
  pageSize?: number = 10

  @ApiProperty({ description: '任务URL', required: false })
  @IsString()
  @IsOptional()
  url?: string

  @ApiProperty({ description: '任务ID', required: false })
  @IsString()
  @IsOptional()
  taskId?: string

  @ApiProperty({ description: '任务类型', required: false, enum: AsrTaskType })
  @IsEnum(AsrTaskType)
  @IsOptional()
  @Transform(({ value }) => Number.parseInt(value, 10))
  taskType?: AsrTaskType

  @ApiProperty({ description: '任务状态', required: false, enum: AsrTaskStatus })
  @IsEnum(AsrTaskStatus)
  @IsOptional()
  @Transform(({ value }) => Number.parseInt(value, 10))
  status?: AsrTaskStatus
}
